import axios from '../../http/http'

const store = {
    namespaced: true,
    state(){
        return {
            specsList: [],
            total: 0
        }
    },
    actions: {
        specsTotalActions({commit}){
            //specscount
            axios.get("/specscount").then(
                res => {
                    commit('specsTotalMutations',res.data.list[0].total)
                } 
            )
        },
        specsListActions({commit},page,size){
            axios.get("/specslist",{params:{page:page,size:size}}).then(
                res => {
                    commit('specsListMutations',res.data.list)
                } 
            )
        }
    },
    mutations: {
        specsTotalMutations(state,count){
            state.total = count
        },
        specsListMutations(state,list){
            state.specsList = list
        }
    }
}

export default store